package com.xcesys.extras.remoting;

import java.util.Collection;
import java.util.List;

import com.xcesys.extras.dataobject.TreeNode;

public interface RemotingTreeCrudService<D extends TreeNode<D>> extends
		RemotingCrudService<D> {

	List<D> findByParentId(Long parentId);

	/**
	 * @param parentId
	 *            parent node id, must not be null.
	 * @return
	 */
	List<D> findAllChildrenByParentId(Long parentId);

	/**
	 * Finds and returns sibling nodes.
	 * 
	 * @param obj
	 *            tree node object.
	 * @return
	 */
	List<D> findSibling(D obj);

	/**
	 * @param obj
	 * @return
	 */
	Integer findSiblingMaxSeq(D obj);

	/**
	 * Moves a tree node down by plus its seq value.
	 * 
	 * @param obj
	 * @return
	 */
	Collection<D> moveDown(D obj);

	/**
	 * Moves a tree node up by minus its seq value.
	 * 
	 * @param obj
	 * @return
	 */
	Collection<D> moveUp(D obj);

}
